{% extends "base.html" %}
{# Copyright The IETF Trust 2021 All Rights Reserved #}
{% load origin %}
{% load person_filters ietf_filters %}
{% load static %}
{% block pagehead %}
    <link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
{% endblock %}
{% block title %}BOF Requests{% endblock %}
{% block content %}
    {% origin %}
    <h1>BOF Requests</h1>
    {% if request.user.is_authenticated %}
        <div class="buttonlist">
            <a id="start_button"
               class="btn btn-primary"
               href="{% url 'ietf.doc.views_bofreq.new_bof_request' %}">
                Start New BOF Request
            </a>
        </div>
    {% endif %}
    {% if not reqs %}
        <p>
            There are currently no BOF Requests
        </p>
    {% else %}
        {% regroup reqs by get_state_slug as grouped_reqs %}
        {% for req_group in grouped_reqs %}
            {% if req_group.grouper != "spam" or request.user|has_role:"Secretariat" %}
                <h2 class="mt-5">{{ req_group.grouper|capfirst }} BOF Requests</h2>
                <table id="bofreqs-{{ req_group.grouper }}"
                    class="table table-sm table-striped tablesorter">
                    <thead>
                        <tr>
                            <th scope="col" data-sort="name">Name</th>
                            <th scope="col" class="d-none d-sm-table-cell" data-sort="date">Date</th>
                            <th scope="col" data-sort="title">Title</th>
                            <th scope="col" data-sort="responsible">Responsible</th>
                            <th scope="col" data-sort="editors">Editors</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for req in req_group.list %}
                            <tr>
                                <td>
                                    <a href="{% url 'ietf.doc.views_doc.document_main' name=req.name %}">{{ req.name }}-{{ req.rev }}</a>
                                </td>
                                <td class="d-none d-sm-table-cell">{{ req.latest_revision_event.time|date:"Y-m-d" }}</td>
                                <td>{{ req.title }}</td>
                                <td>
                                    {% for person in req.responsible %}
                                        {% person_link person %}{% if not forloop.last %},{% endif %}
                                    {% endfor %}
                                </td>
                                <td>
                                    {% for person in req.editors %}
                                        {% person_link person %}{% if not forloop.last %},{% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            {% endif %}
        {% endfor %}
    {% endif %}
{% endblock %}
{% block js %}
    <script src="{% static "ietf/js/list.js" %}"></script>
{% endblock %}